package ihistoryApp;

import ihistoryApp.server.BattleServer;
import ihistoryApp.server.MessageServer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.socket.config.annotation.EnableWebSocket;

@MapperScan("ihistoryApp.dal.mapper*")
@SpringBootApplication
@EnableWebSocket
public class IHistoryApplication {

    public static void main(String[] args) {
//        SpringApplication.run(IHistoryApplication.class, args);
        SpringApplication springApplication = new SpringApplication(IHistoryApplication.class);
        ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);
        //解决WebSocket不能注入的问题
        MessageServer.setApplicationContext(configurableApplicationContext);
        BattleServer.setApplicationContext(configurableApplicationContext);
    }

}
